Misc. changes and coverage excludes
This commit is contained in:
parent
23b68e4634
commit
6e1f37eabd
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ admin.env
|
||||
_meta
|
||||
.serverless
|
||||
db/
|
||||
.coverage
|
||||
htmlcov/
|
8
cache.py
8
cache.py
@ -8,7 +8,7 @@ import boto3
|
||||
link_cache_system = config['config']['link_cache']
|
||||
|
||||
DYNAMO_CACHE_TBL=None
|
||||
if link_cache_system=="dynamodb":
|
||||
if link_cache_system=="dynamodb": # pragma: no cover
|
||||
DYNAMO_CACHE_TBL=config['config']['table']
|
||||
|
||||
if link_cache_system == "json":
|
||||
@ -35,7 +35,7 @@ elif link_cache_system == "db":
|
||||
client = pymongo.MongoClient(config['config']['database'], connect=False)
|
||||
table = config['config']['table']
|
||||
db = client[table]
|
||||
elif link_cache_system == "dynamodb":
|
||||
elif link_cache_system == "dynamodb": # pragma: no cover
|
||||
client = boto3.resource('dynamodb')
|
||||
|
||||
def serializeUnknown(obj):
|
||||
@ -57,7 +57,7 @@ def addVnfToLinkCache(video_link, vnf):
|
||||
return None
|
||||
elif link_cache_system == "ram": # FOR TESTS ONLY
|
||||
link_cache[video_link] = vnf
|
||||
elif link_cache_system == "dynamodb":
|
||||
elif link_cache_system == "dynamodb": # pragma: no cover
|
||||
vnf["ttl"] = int(vnf["ttl"].strftime('%s'))
|
||||
table = client.Table(DYNAMO_CACHE_TBL)
|
||||
table.put_item(
|
||||
@ -98,7 +98,7 @@ def getVnfFromLinkCache(video_link):
|
||||
else:
|
||||
print(" ➤ [ X ] Link not in json cache")
|
||||
return None
|
||||
elif link_cache_system == "dynamodb":
|
||||
elif link_cache_system == "dynamodb": # pragma: no cover
|
||||
table = client.Table(DYNAMO_CACHE_TBL)
|
||||
response = table.get_item(
|
||||
Key={
|
||||
|
@ -3,7 +3,7 @@ import os
|
||||
|
||||
if ('RUNNING_TESTS' in os.environ):
|
||||
config= {"config":{"link_cache":"ram","database":"","table":"","color":"","appname": "vxTwitter","repo": "https://github.com/dylanpdx/BetterTwitFix","url": "https://vxtwitter.com","combination_method": "local"}}
|
||||
elif ('RUNNING_SERVERLESS' in os.environ and os.environ['RUNNING_SERVERLESS'] == '1'):
|
||||
elif ('RUNNING_SERVERLESS' in os.environ and os.environ['RUNNING_SERVERLESS'] == '1'): # pragma: no cover
|
||||
config = {
|
||||
"config":{
|
||||
"link_cache":os.environ["VXTWITTER_LINK_CACHE"],
|
||||
|
1
run_tests.sh
Normal file
1
run_tests.sh
Normal file
@ -0,0 +1 @@
|
||||
pytest --cov-config=.coveragerc --cov=. --cov-report html
|
@ -158,7 +158,7 @@ def dir(sub_path):
|
||||
return redirect(url, 301)
|
||||
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
def favicon(): # pragma: no cover
|
||||
return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico',mimetype='image/vnd.microsoft.icon')
|
||||
|
||||
@app.route("/rendercombined.jpg")
|
||||
@ -273,13 +273,6 @@ def tweetInfo(url, tweet="", desc="", thumb="", uploader="", screen_name="", pfp
|
||||
}
|
||||
return vnf
|
||||
|
||||
def get_tweet_data_from_api(video_link):
|
||||
print(" ➤ [ + ] Attempting to download tweet info from Twitter API")
|
||||
twid = int(re.sub(r'\?.*$','',video_link.rsplit("/", 1)[-1])) # gets the tweet ID as a int from the passed url
|
||||
tweet = twitter_api.statuses.show(_id=twid, tweet_mode="extended")
|
||||
#print(tweet) # For when I need to poke around and see what a tweet looks like
|
||||
return tweet
|
||||
|
||||
def link_to_vnf_from_tweet_data(tweet,video_link):
|
||||
imgs = ["","","","", ""]
|
||||
print(" ➤ [ + ] Tweet Type: " + tweetType(tweet))
|
||||
|
Loading…
x
Reference in New Issue
Block a user