Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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"
Ejemplo n.º 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"
Ejemplo n.º 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)
Ejemplo n.º 10
0
def test_login(application):
    view = ViaWebUI.navigate_to(application.web_ui, "LoggedIn")
    assert view.is_displayed
Ejemplo n.º 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()