예제 #1
0
 def exists(self):
     profile = self.parent.filters.get("parent")
     if profile:
         view = ViaWebUI.navigate_to(profile, "Details")
     else:
         view = ViaWebUI.navigate_to(self.parent, "All")
     return view.posts(self.post_id).is_displayed
예제 #2
0
 def delete(self):
     profile = self.parent.filters.get("parent")
     if profile:
         view = ViaWebUI.navigate_to(profile, "Details")
     else:
         view = ViaWebUI.navigate_to(self.parent, "All")
     view.posts(self.post_id).delete()
예제 #3
0
 def update(self, username=None, about=None, city=None):
     view = ViaWebUI.navigate_to(self, "Edit")
     changed = view.fill({"username": username, "about": about, "city": city})
     if changed:
         self.username = username
         view.submit.click()
         ViaWebUI.navigate_to(self, "Details")
예제 #4
0
 def update(self, username=None, about=None):
     view = ViaWebUI.navigate_to(self, "Edit")
     wait_for(lambda: view.is_displayed)
     changed = view.fill({"username": username, "about": about})
     if changed:
         self.username = username
         view.submit.click()
         ViaWebUI.navigate_to(self, "Details")
예제 #5
0
 def all(self):
     profile = self.filters.get("parent")
     if profile:
         view = ViaWebUI.navigate_to(profile, "Details")
     else:
         view = ViaWebUI.navigate_to(self, "All")
     posts = []
     for post_id in view.posts.view_class.all(view.browser):
         posts.append(self.instantiate(post_id[0]))
     return posts
예제 #6
0
 def create(self, content):
     view = ViaWebUI.navigate_to(self, "All")
     changed = view.fill({"text_area": content})
     if changed:
         post = self.instantiate(view.posts.view_class._last_post_id(view.browser)[0] + 1)
         view.submit.click()
         return post
예제 #7
0
def test_edit_profile(application, request):
    profile = application.collections.profiles.instantiate(username=application.username)

    @request.addfinalizer
    def _revert():
        profile.update(username="******", about="")

    profile.update(username="******", about="My bio")
    view = ViaWebUI.navigate_to(profile, "Details")
    assert view.title.text == "User: new_user"
예제 #8
0
def test_edit_profile(application, request):
    profile = application.collections.profiles.instantiate(
        username=application.username)

    @request.addfinalizer
    def _revert():
        profile.update(username="******", about="")

    profile.update(username="******", about="My bio")
    view = ViaWebUI.navigate_to(profile, "Details")
    wait_for(lambda: view.is_displayed)
    assert view.title.text == "User: misharov2"
예제 #9
0
 def __init__(self,
              hostname=None,
              path="",
              scheme="https",
              username=None,
              password=None):
     self.application = self
     self.hostname = hostname
     self.path = path
     self.scheme = scheme
     self.username = username
     self.password = password
     self.web_ui = ViaWebUI(owner=self)
     self.context = MtImplementationContext.from_instances([self.web_ui])
     self.collections = EntityCollections.for_application(self)
예제 #10
0
def test_login(application):
    view = ViaWebUI.navigate_to(application.web_ui, "LoggedIn")
    assert view.is_displayed
예제 #11
0
 def delete(self, *post_ids):
     profile = self.filters.get("profile")
     ViaWebUI.navigate_to(profile, "Details") if profile else ViaWebUI.navigate_to(self, "All")
     for post_id in post_ids:
         post = self.instantiate(post_id)
         post.delete()