generated from nyu-software-engineering/final-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/software-students-spring202…
…4/5-final-project-spring-2024-mjetteam into ele-branch
- Loading branch information
Showing
36 changed files
with
581 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#environment variables | ||
.env | ||
src/.env | ||
|
||
# mac junk | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
pytest = "*" | ||
flask = "*" | ||
pymongo = "*" | ||
python-dotenv = "*" | ||
flask-login = "*" | ||
flask-bcrypt = "*" | ||
pytest-cov = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.8" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{"t":{"$date":"2024-04-26T04:49:37.920Z"},"s":"I","c":"MONGOSH","id":1000000000,"ctx":"log","msg":"Starting log","attr":{"execPath":"/usr/bin/mongosh","envInfo":{"EDITOR":null,"NODE_OPTIONS":null,"TERM":null},"version":"2.2.5","distributionKind":"compiled","buildArch":"x64","buildPlatform":"linux","buildTarget":"linux-x64","buildTime":"2024-04-24T14:22:21.076Z","gitVersion":"3a95f1de5ce644bf6e5453c73b6ccd05a35dcfa5","nodeVersion":"v20.12.2","opensslVersion":"3.0.13+quic","sharedOpenssl":false,"runtimeArch":"x64","runtimePlatform":"linux","runtimeGlibcVersion":"2.35","deps":{"nodeDriverVersion":"6.5.0","libmongocryptVersion":"1.9.0-20230828+git8e7f69f1c0","libmongocryptNodeBindingsVersion":"6.0.0","kerberosVersion":"2.1.0"}}} | ||
{"t":{"$date":"2024-04-26T04:49:37.934Z"},"s":"I","c":"MONGOSH","id":1000000005,"ctx":"config","msg":"User updated"} | ||
{"t":{"$date":"2024-04-26T04:49:37.935Z"},"s":"I","c":"MONGOSH","id":1000000048,"ctx":"config","msg":"Loading global configuration file","attr":{"filename":"/etc/mongosh.conf","found":false}} | ||
{"t":{"$date":"2024-04-26T04:49:37.962Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000042,"ctx":"mongosh-connect","msg":"Initiating connection attempt","attr":{"uri":"mongodb://127.0.0.1:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.5","driver":{"name":"nodejs|mongosh","version":"6.5.0|2.2.5"},"devtoolsConnectVersion":"2.6.0","host":"127.0.0.1:27017"}} | ||
{"t":{"$date":"2024-04-26T04:49:37.974Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000035,"ctx":"mongosh-connect","msg":"Server heartbeat succeeded","attr":{"connectionId":"127.0.0.1:27017"}} | ||
{"t":{"$date":"2024-04-26T04:49:38.042Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000037,"ctx":"mongosh-connect","msg":"Connection attempt finished"} | ||
{"t":{"$date":"2024-04-26T04:49:38.082Z"},"s":"I","c":"MONGOSH","id":1000000004,"ctx":"connect","msg":"Connecting to server","attr":{"session_id":"662b3261221b58109f2202d7","userId":null,"telemetryAnonymousId":"662b3261fb0e9fa0142202d6","connectionUri":"mongodb://<ip address>:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.5","is_atlas":false,"is_localhost":true,"is_do":false,"server_version":"7.0.8","node_version":"v20.12.2","mongosh_version":"2.2.5","server_os":"linux","server_arch":"x86_64","is_enterprise":false,"auth_type":null,"is_data_federation":false,"is_stream":false,"dl_version":null,"atlas_version":null,"is_genuine":true,"non_genuine_server_name":"mongodb","is_local_atlas":false,"fcv":"7.0","api_version":null,"api_strict":null,"api_deprecation_errors":null}} | ||
{"t":{"$date":"2024-04-26T04:49:38.088Z"},"s":"I","c":"MONGOSH","id":1000000010,"ctx":"shell-api","msg":"Initialized context","attr":{"method":"setCtx","arguments":{}}} | ||
{"t":{"$date":"2024-04-26T04:49:38.092Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000024,"ctx":"snippets","msg":"Fetching snippet index","attr":{"refreshMode":"allow-cached"}} | ||
{"t":{"$date":"2024-04-26T04:49:38.095Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000019,"ctx":"snippets","msg":"Loaded snippets","attr":{"installdir":"/data/db/.mongodb/mongosh/snippets"}} | ||
{"t":{"$date":"2024-04-26T04:49:38.191Z"},"s":"I","c":"MONGOSH-SNIPPETS","id":1000000028,"ctx":"snippets","msg":"Modifying snippets package.json failed","attr":{"error":"ENOENT: no such file or directory, open '/data/db/.mongodb/mongosh/snippets/package.json'"}} | ||
{"t":{"$date":"2024-04-26T04:49:38.207Z"},"s":"I","c":"MONGOSH","id":1000000002,"ctx":"repl","msg":"Started REPL","attr":{"version":"2.2.5"}} | ||
{"t":{"$date":"2024-04-26T04:49:38.380Z"},"s":"I","c":"MONGOSH","id":1000000011,"ctx":"shell-api","msg":"Performed API call","attr":{"method":"createUser","class":"Database","db":"admin","arguments":{}}} | ||
{"t":{"$date":"2024-04-26T04:49:38.518Z"},"s":"I","c":"MONGOSH","id":1000000045,"ctx":"analytics","msg":"Flushed outstanding data","attr":{"flushError":"Trying to persist throttle state before userId is set","flushDuration":0}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{"t":{"$date":"2024-04-26T04:49:37.170Z"},"s":"I","c":"MONGOSH","id":1000000000,"ctx":"log","msg":"Starting log","attr":{"execPath":"/usr/bin/mongosh","envInfo":{"EDITOR":null,"NODE_OPTIONS":null,"TERM":null},"version":"2.2.5","distributionKind":"compiled","buildArch":"x64","buildPlatform":"linux","buildTarget":"linux-x64","buildTime":"2024-04-24T14:22:21.076Z","gitVersion":"3a95f1de5ce644bf6e5453c73b6ccd05a35dcfa5","nodeVersion":"v20.12.2","opensslVersion":"3.0.13+quic","sharedOpenssl":false,"runtimeArch":"x64","runtimePlatform":"linux","runtimeGlibcVersion":"2.35","deps":{"nodeDriverVersion":"6.5.0","libmongocryptVersion":"1.9.0-20230828+git8e7f69f1c0","libmongocryptNodeBindingsVersion":"6.0.0","kerberosVersion":"2.1.0"}}} | ||
{"t":{"$date":"2024-04-26T04:49:37.216Z"},"s":"I","c":"MONGOSH","id":1000000048,"ctx":"config","msg":"Loading global configuration file","attr":{"filename":"/etc/mongosh.conf","found":false}} | ||
{"t":{"$date":"2024-04-26T04:49:37.268Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000042,"ctx":"mongosh-connect","msg":"Initiating connection attempt","attr":{"uri":"mongodb://127.0.0.1:27017/admin?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.5","driver":{"name":"nodejs|mongosh","version":"6.5.0|2.2.5"},"devtoolsConnectVersion":"2.6.0","host":"127.0.0.1:27017"}} | ||
{"t":{"$date":"2024-04-26T04:49:37.295Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000035,"ctx":"mongosh-connect","msg":"Server heartbeat succeeded","attr":{"connectionId":"127.0.0.1:27017"}} | ||
{"t":{"$date":"2024-04-26T04:49:37.555Z"},"s":"I","c":"DEVTOOLS-CONNECT","id":1000000037,"ctx":"mongosh-connect","msg":"Connection attempt finished"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"userId":"662b3261fb0e9fa0142202d6","telemetryAnonymousId":"662b3261fb0e9fa0142202d6","enableTelemetry":true} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
WiredTiger | ||
WiredTiger 11.2.0: (November 10, 2022) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
WiredTiger lock file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
WiredTiger version string | ||
WiredTiger 11.2.0: (November 10, 2022) | ||
WiredTiger version | ||
major=11,minor=2,patch=0 | ||
file:WiredTiger.wt | ||
access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.448=(addr="018981e4488df4fb8a81e4d676e1678b81e42d23a08c808080e3010fc0e23fc0",order=448,time=1714182272,size=28672,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=448,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=1343,run_write_gen=9)),checkpoint_backup_info=,checkpoint_lsn=(2,345216) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
blinker==1.8.1 | ||
click==8.1.7 | ||
dnspython==2.6.1 | ||
Flask==3.0.3 | ||
iniconfig==2.0.0 | ||
itsdangerous==2.2.0 | ||
Jinja2==3.1.3 | ||
MarkupSafe==2.1.5 | ||
packaging==24.0 | ||
pluggy==1.5.0 | ||
pymongo==4.7.0 | ||
pytest==8.2.0 | ||
python-dotenv==1.0.1 | ||
Werkzeug==3.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import pytest | ||
from app import app, db | ||
|
||
import datetime | ||
from bson.objectid import ObjectId | ||
from bson.decimal128 import Decimal128 | ||
|
||
TEST_USER_POST = {'fusername': 'marc3', 'fpassword': 'password'} | ||
TEST_INCORRECT_POST = {'fusername': 'marc3', 'fpassword': 'assword'} | ||
TEST_USER_MONGO = {'username': 'marc3'} | ||
db.users.delete_one(TEST_USER_MONGO) | ||
|
||
TEST_ITEM_POST = {'itemname': '5555', 'description': '5555', 'price': '555', 'url': '555'} | ||
TEST_ITEM_MONGO = {'name': '5555', 'description': '5555', 'username': 'marc1', 'image_url': '555', 'price': Decimal128('555')} | ||
#db.items.delete_one(TEST_ITEM_MONGO) | ||
|
||
@pytest.fixture | ||
def client(): | ||
app.config.update({"TESTING": True}) | ||
|
||
with app.test_client() as client: | ||
yield client | ||
|
||
@pytest.fixture | ||
def user(client): | ||
client.post('/signup', data = TEST_USER_POST) | ||
|
||
@pytest.fixture | ||
def login(client, user): | ||
client.post('/login', data = TEST_USER_POST) | ||
|
||
def test_homepage(client): | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
|
||
#create a user and attempt to create the same user again | ||
def test_user_already_exists(client, user): | ||
res = client.post('/signup', data = TEST_USER_POST) | ||
assert 'Username already in use.' in str(res.data) | ||
|
||
#login with wrong username and test that an error message is returned | ||
def test_incorrect_login(client, user): | ||
res = client.post('/login', data = TEST_INCORRECT_POST) | ||
assert "Username or password is invalid." in str(res.data) | ||
|
||
#make user post an item to a page and check to see that that item is on the page | ||
def test_user_add_item(client, user): | ||
client.post('/add') | ||
|
||
#test to see | ||
def test_index_page__not_logged_in(client): | ||
res = client.get('/add') | ||
assert res.status_code == 302 | ||
|
||
def test_index_page__logged_in(client, user): | ||
client.post('/login', data = TEST_USER_POST) | ||
res = client.get('/add') | ||
assert res.status_code == 200 | ||
|
||
def test_home(client): | ||
res = client.get('/') | ||
assert res.status_code == 200 | ||
|
||
def test_logout(): | ||
client.post('/logout',) | ||
assert 1 == 1 | ||
|
||
def test_item(): | ||
res = client.get('/item') | ||
assert res.status_code == 200 | ||
|
||
def test_add(): | ||
response = client.get('/add') | ||
assert response.status_code == 200 | ||
|
||
def test_create_item(client, user, login): | ||
client.post('/add/<user_id>', data = TEST_ITEM_POST) | ||
res = client.get('/add') | ||
assert 1 == 1 | ||
|
||
def test_delete(client, user, login): | ||
client.post("/delete/<item_id>", data = TEST_ITEM_POST) | ||
res = client.get('/delete') | ||
assert res.status_code == 200 | ||
|
||
def test_delete_offer(client): | ||
response = client.get('/') | ||
|
||
def test_edit(client): | ||
response = client.get('/') | ||
|
||
def test_update_item(client): | ||
response = client.get('/') | ||
|
||
def test_view_listings(client): | ||
response = client.get('/') | ||
|
||
def test_set_public(client): | ||
response = client.get('/') | ||
|
||
def test_set_private(client): | ||
response = client.get("/setprivate/<item_id>") | ||
assert response.status_code == 200 | ||
|
||
def test_offer(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
def test_view_offer(client): | ||
response = client.get('') | ||
assert response.status_code == 200 | ||
|
||
def test_sent_offers(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
def test_recieved_offers(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
def test_accepts_offers(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
def test_reject_offer(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
def test_unauthorized_handler(client): | ||
response = client.get('/') | ||
assert response.status_code == 200 | ||
|
||
db.users.delete_one(TEST_USER_MONGO) | ||
#db.items.delete_one(TEST_ITEM_MONGO) | ||
pytest.main() |