本文整理汇总了Python中utils.spin_assert函数的典型用法代码示例。如果您正苦于以下问题:Python spin_assert函数的具体用法?Python spin_assert怎么用?Python spin_assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spin_assert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dashboard
def test_dashboard(self):
signin(self, 'bob', 'bob_secret')
spin_assert(lambda: self.assertEquals(self.browser.title,
'SylvaDB - Dashboard'))
text = self.browser.find_by_xpath(
"//header[@class='global']/h1").first.value
spin_assert(lambda: self.assertEqual(text, 'Dashboard'))
示例2: test_graph_change_with_permissions
def test_graph_change_with_permissions(self):
signup(self, 'alice', '[email protected]', 'alice_secret')
signin(self, 'alice', 'alice_secret')
logout(self)
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
create_graph(self)
self.browser.find_by_xpath(
"//div[@class='dashboard-graphs']/div/div/span[@class='graph-title']/a"
).first.click()
add_permission(self, 'alice', CREATE_COLLAB)
add_permission(self, 'alice', GRAPH_CHANGE)
logout(self)
signin(self, 'alice', 'alice_secret')
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
self.browser.find_by_xpath(
"//div[@class='graph-item']/span[@class='graph-title']/a"
).first.click()
self.browser.find_by_xpath("//input[@id='id_name']").first.fill(
"Alice's graph")
self.browser.find_by_xpath(
"//form/input[@type='submit']").first.click()
text = self.browser.find_by_xpath(
"//div[@class='graph-item']/span[@class='graph-title']/a"
).first.value
spin_assert(lambda: self.assertEqual(text, "Alice's graph"))
Graph.objects.get(name="Alice's graph").destroy()
示例3: test_schema_change_with_permissions
def test_schema_change_with_permissions(self):
signup(self, 'alice', '[email protected]', 'alice_secret')
signin(self, 'alice', 'alice_secret')
logout(self)
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
create_graph(self)
create_schema(self)
create_type(self)
add_permission(self, 'alice', CREATE_COLLAB)
add_permission(self, 'alice', SCHEMA_VIEW)
add_permission(self, 'alice', SCHEMA_CHANGE)
logout(self)
signin(self, 'alice', 'alice_secret')
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
self.browser.find_by_xpath(
"//nav[@class='menu']/ul/li[3]/a").first.click()
self.browser.find_by_xpath("//fieldset[@class='module aligned wide model']/h2/a").first.click()
self.browser.find_by_xpath(
"//input[@id='id_name']").first.fill("Alice's type")
self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkLeft']/input[@type='submit']").first.click()
text = self.browser.find_by_xpath(
"//fieldset[@class='module aligned wide model']/h2/a").first.value
spin_assert(lambda: self.assertEqual(text, "Alice's type"))
Graph.objects.get(name="Bob's graph").destroy()
示例4: test_data_change_without_permissions
def test_data_change_without_permissions(self):
signup(self, 'alice', '[email protected]', 'alice_secret')
signin(self, 'alice', 'alice_secret')
logout(self)
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
create_graph(self)
create_schema(self)
create_type(self)
create_data(self)
add_permission(self, 'alice', CREATE_COLLAB)
add_permission(self, 'alice', DATA_VIEW)
logout(self)
signin(self, 'alice', 'alice_secret')
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
spin_click(
self.browser.find_by_xpath("//a[@id='dataMenu']").first,
self.browser.find_by_xpath(
"//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']"
).first)
self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
text = self.browser.find_by_xpath(
"//div[@class='heading']/h1").first.value
spin_assert(lambda: self.assertNotEqual(text.find("403"), -1))
Graph.objects.get(name="Bob's graph").destroy()
示例5: test_data_change_with_permissions
def test_data_change_with_permissions(self):
signup(self, 'alice', '[email protected]', 'alice_secret')
signin(self, 'alice', 'alice_secret')
logout(self)
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
create_graph(self)
create_schema(self)
create_type(self)
create_data(self)
add_permission(self, 'alice', CREATE_COLLAB)
add_permission(self, 'alice', DATA_VIEW)
add_permission(self, 'alice', DATA_CHANGE)
logout(self)
signin(self, 'alice', 'alice_secret')
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
spin_click(self.browser.find_by_xpath("//a[@id='dataMenu']").first,
self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first)
self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
self.browser.find_by_xpath(
"//input[@id='id_Name']").first.fill("Alice's node")
self.browser.find_by_xpath("//input[@type='submit']").first.click()
text = self.browser.find_by_xpath("//table[@id='content_table']/tbody/tr/td")[1].value
spin_assert(lambda: self.assertEqual(text, "Alice's node"))
Graph.objects.get(name="Bob's graph").destroy()
示例6: import_advanced_schema_csv
def import_advanced_schema_csv(test, name_export, name_import):
"""
Import the schema for one graph. The parameters are the name of
the graph to import and the graph from import. Csv format.
"""
create_graph(test, name_import)
spin_assert(lambda: test.assertEqual(
test.browser.title, 'SylvaDB - Dashboard'))
test.browser.find_link_by_href('/graphs/' + name_import + '/').first.click()
test.browser.is_text_present('Your Schema is empty.')
spin_assert(lambda: test.assertEqual(
test.browser.title, "SylvaDB - " + name_import))
test.browser.find_link_by_href(
'/schemas/' + name_import + '/').first.click()
spin_assert(lambda: test.assertEqual(test.browser.title, "SylvaDB - " + name_import))
test.browser.find_by_id('schemaImport').first.click()
file_path = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'files/csv/bobgraph_rel_schema.json'
)
test.browser.attach_file('file', file_path)
test.browser.find_by_value('Continue').first.click()
spin_assert(lambda: test.assertEqual(test.browser.title, "SylvaDB - " + name_import))
text = test.browser.find_by_id('diagramBoxField_' + name_import + '.bobs-type-2.undefined').first.value
spin_assert(lambda: test.assertEqual(text, "Name"))
示例7: test_data_delete_with_permissions
def test_data_delete_with_permissions(self):
signup(self, 'alice', '[email protected]', 'alice_secret')
signin(self, 'alice', 'alice_secret')
logout(self)
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
create_graph(self)
create_schema(self)
create_type(self)
create_data(self)
add_permission(self, 'alice', CREATE_COLLAB)
add_permission(self, 'alice', DATA_VIEW)
add_permission(self, 'alice', DATA_CHANGE)
add_permission(self, 'alice', DATA_DELETE)
logout(self)
signin(self, 'alice', 'alice_secret')
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
spin_click(self.browser.find_by_xpath("//a[@id='dataMenu']").first,
self.browser.find_by_xpath("//div[@id='dataBrowse']/table/tbody/tr/td/a[@class='dataOption list']").first)
self.browser.find_by_xpath("//td/a[@title='Edit node']").first.click()
self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[text()='Remove']").first.click()
self.browser.choose('confirm', '1')
self.browser.find_by_xpath("//input[@type='submit']").first.click()
text = self.browser.find_by_xpath(
"//div[@id='content2']/div[@class='indent']").first.value
spin_assert(lambda: self.assertNotEqual(text.find('Nodes: 0'), -1))
Graph.objects.get(name="Bob's graph").destroy()
示例8: test_user_logout
def test_user_logout(self):
signup(self, 'bob', '[email protected]', 'bob_secret')
signin(self, 'bob', 'bob_secret')
logout(self)
spin_assert(lambda: self.assertEqual(
self.browser.title, 'SylvaDB - Signed out'))
spin_assert(lambda: self.assertEqual(self.browser.find_by_css('.body-inside').first.value, 'You have been signed out. Till we meet again.'))
示例9: test_query_list_view
def test_query_list_view(self):
create_graph(self)
create_schema(self)
create_type(self)
self.browser.find_by_id('queriesMenu').first.click()
button_text = self.browser.find_by_id('create-query').first.value
spin_assert(lambda: self.assertEqual(button_text, "New Query"))
示例10: test_data_node_addition_rel_add_del
def test_data_node_addition_rel_add_del(self):
create_graph(self)
create_schema(self)
create_type(self)
create_node(self, "Bob")
create_node(self, "Alice")
# We create a allowed relation
js_code = "$('a#schema-link')[0].click();"
self.browser.execute_script(js_code)
self.browser.find_by_id('allowedRelations').first.click()
self.browser.select('source', '1')
self.browser.find_by_name('name').fill("Bob's rel")
self.browser.select('target', '1')
self.browser.find_by_id('id_description').fill("This the allowed relationship for Bob's graph")
self.browser.find_by_value('Save Type').first.click()
spin_assert(lambda: self.assertEqual(
self.browser.title, "SylvaDB - Bob's graph"))
# We create the link between the nodes
self.browser.find_by_id('dataMenu').first.click()
self.browser.find_by_xpath("//td[@class='dataActions']/a[@class='dataOption list']").first.click()
self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
self.browser.find_by_xpath("//li[@class='token-input-input-token']/input").first.fill('Alice')
self.browser.is_element_present_by_id("id_user_wait", 5)
self.browser.find_by_xpath("//div[@class='token-input-dropdown']//li[@class='token-input-dropdown-item2 token-input-selected-dropdown-item']/b").first.click()
self.browser.find_by_value("Save Bob's type").first.click()
# Delete the relationship
self.browser.find_by_xpath("//td[@class='dataList']/a[@class='edit']").first.click()
self.browser.find_by_xpath("//span[@class='all-relationships incoming-relationships i_bobs_rel1-relationships']//a[@class='delete-row initial-form floating']").first.click()
self.browser.find_by_value("Save Bob's type").first.click()
self.browser.find_link_by_href('/graphs/bobs-graph/').first.click()
text = self.browser.find_by_xpath("//div[@class='flags-block']/span[@class='graph-relationships']").first.value
spin_assert(lambda: self.assertEqual(text, "0 relationships"))
Graph.objects.get(name="Bob's graph").destroy()
示例11: test_user_singup_empty_password
def test_user_singup_empty_password(self):
self.browser.visit(self.live_server_url + '/accounts/signup/')
self.browser.find_by_name('username').fill('bob')
self.browser.find_by_name('email').fill('[email protected]')
self.browser.find_by_name('password1').fill('')
self.browser.find_by_name('password2').fill('bob_secret')
self.browser.find_by_value('Signup').first.click()
text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
spin_assert(lambda: self.assertEqual(text, 'This field is required.'))
示例12: test_user_signin_bad_password
def test_user_signin_bad_password(self):
signup(self, 'bob', '[email protected]', 'bob_secret')
self.browser.visit(self.live_server_url + '/accounts/signin/')
self.browser.find_by_name('identification').fill('bob')
self.browser.find_by_name('password').fill('alice_secret')
self.browser.find_by_xpath(
"//div[@id='body']/div/form/input")[1].click()
text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
spin_assert(lambda: self.assertEqual(text, 'Please enter a correct username or email and password. Note that both fields are case-sensitive.'))
示例13: test_user_signin_empty_password
def test_user_signin_empty_password(self):
signup(self, 'bob', '[email protected]', 'bob_secret')
self.browser.visit(self.live_server_url + '/accounts/signin/')
self.browser.find_by_name('identification').fill('bob')
self.browser.find_by_name('password').fill('')
self.browser.find_by_xpath(
"//div[@id='body']/div/form/input")[1].click()
text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
spin_assert(lambda: self.assertEqual(text, 'This field is required.'))
示例14: test_user_singup_password_unmatched
def test_user_singup_password_unmatched(self):
self.browser.visit(self.live_server_url + '/accounts/signup/')
self.browser.find_by_name('username').fill('bob')
self.browser.find_by_name('email').fill('[email protected]')
self.browser.find_by_name('password1').fill('bob_secret')
self.browser.find_by_name('password2').fill('bob_password')
self.browser.find_by_value('Signup').first.click()
text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
spin_assert(lambda: self.assertEqual(
text, "The two password fields didn't match."))
示例15: test_user_singup_bad_email
def test_user_singup_bad_email(self):
self.browser.visit(self.live_server_url + '/accounts/signup/')
self.browser.find_by_name('username').fill('bob')
self.browser.find_by_name('email').fill('bobcultureplex.ca')
self.browser.find_by_name('password1').fill('bob_secret')
self.browser.find_by_name('password2').fill('bob_secret')
self.browser.find_by_value('Signup').first.click()
text = self.browser.find_by_xpath("//ul[@class='errorlist']/li").first.text
spin_assert(lambda: self.assertEqual(
text, 'Enter a valid email address.'))