Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tests for permissioning #60

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions tests/test_vanna.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,37 @@ def test_get_all_questions():
# rv = vn.get_accuracy_stats()
# assert rv == AccuracyStats(num_questions=2, data={'No SQL Generated': 2, 'SQL Unable to Run': 0, 'Assumed Correct': 0, 'Flagged for Review': 0, 'Reviewed and Approved': 0, 'Reviewed and Rejected': 0, 'Reviewed and Updated': 0})

def test_add_documentation():
def test_add_documentation_fail():
rv = vn.add_documentation(documentation="This is the documentation")
assert rv == False

def test_add_ddl_pass_fail():
rv = vn.add_ddl(ddl="This is the ddl")
assert rv == False

def test_add_sql_pass_fail():
rv = vn.add_sql(question="How many students are there?", sql="SELECT * FROM students")
assert rv == False

def test_add_documentation_pass(monkeypatch):
switch_to_user('user1', monkeypatch)
vn.set_model('test_org')
rv = vn.add_documentation(documentation="This is the documentation")
assert rv == True

def test_add_ddl():
def test_add_ddl_pass():
rv = vn.add_ddl(ddl="This is the ddl")
assert rv == True

def test_add_sql2():
def test_add_sql_pass():
rv = vn.add_sql(question="How many students are there?", sql="SELECT * FROM students")
assert rv == True

num_training_data = 4

def test_get_training_data():
rv = vn.get_training_data()
assert rv.shape == (3, 4)
assert rv.shape == (num_training_data, 4)

def test_remove_training_data():
training_data = vn.get_training_data()
Expand All @@ -199,7 +215,7 @@ def test_remove_training_data():
rv = vn.remove_training_data(row['id'])
assert rv == True

assert vn.get_training_data().shape[0] == 2-index
assert vn.get_training_data().shape[0] == num_training_data-1-index

def test_create_model_and_add_user():
created = vn.create_model('test_org2', 'Snowflake')
Expand Down