diff --git a/Dockerfile.buildozer b/Dockerfile.buildozer index a8f37db4..4a9a9b70 100644 --- a/Dockerfile.buildozer +++ b/Dockerfile.buildozer @@ -33,10 +33,7 @@ RUN apt install -qq --yes --no-install-recommends \ sudo \ unzip \ zip \ - zlib1g-dev \ - libncurses5-dev \ - libncursesw5-dev \ - libtinfo5 + zlib1g-dev RUN pip3 install "cython==0.28.6" RUN pip3 install "buildozer==1.0" diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index 9c6ba554..8e97d8a8 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -7,12 +7,9 @@ from kivy.properties import ( ListProperty, StringProperty ) -from kivy.uix.button import Button from kivymd.uix.button import MDRaisedButton -from kivy.uix.carousel import Carousel from kivymd.uix.dialog import MDDialog from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem from kivy.uix.screenmanager import Screen import state @@ -73,14 +70,14 @@ class AddressBook(Screen): """Creating the mdList""" for item in self.queryreturn[start_index:end_index]: message_row = SwipeToDeleteItem( - text = item[0], + text=item[0], ) listItem = message_row.ids.content listItem.secondary_text = item[1] listItem.theme_text_color = "Custom" listItem.text_color = ThemeClsColor listItem.add_widget(AvatarSampleWidget( - source=state.imageDir + '/text_images/{}.png'.format( + source=state.imageDir + '/text_images/{}.png'.format( avatarImageFirstLetter(item[0].strip())))) listItem.bind(on_release=partial( self.addBook_detail, item[1], item[0], message_row)) diff --git a/src/bitmessagekivy/baseclass/allmail.py b/src/bitmessagekivy/baseclass/allmail.py index c0623986..bca09ed7 100644 --- a/src/bitmessagekivy/baseclass/allmail.py +++ b/src/bitmessagekivy/baseclass/allmail.py @@ -1,28 +1,23 @@ -from bitmessagekivy import kivy_helper_search from bmconfigparser import BMConfigParser from helper_sql import sqlExecute, sqlQuery from functools import partial from kivy.clock import Clock -from kivy.metrics import dp from kivy.properties import ( ListProperty, StringProperty ) -from kivy.uix.button import Button -from kivy.uix.carousel import Carousel from kivy.uix.screenmanager import Screen from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem import state from bitmessagekivy.baseclass.common import ( showLimitedCnt, toast, ThemeClsColor, - avatarImageFirstLetter,CutsomSwipeToDeleteItem, + avatarImageFirstLetter, CutsomSwipeToDeleteItem, ShowTimeHistoy ) from bitmessagekivy.baseclass.maildetail import MailDetail -from bitmessagekivy.baseclass.trash import Trash +# from bitmessagekivy.baseclass.trash import Trash class Allmails(Screen): @@ -96,7 +91,7 @@ class Allmails(Screen): body = item[3].decode() if isinstance(item[3], bytes) else item[3] subject = item[2].decode() if isinstance(item[2], bytes) else item[2] message_row = CutsomSwipeToDeleteItem( - text = item[1], + text=item[1], ) listItem = message_row.ids.content @@ -113,8 +108,6 @@ class Allmails(Screen): self.mail_detail, item[5], item[4], message_row)) message_row.ids.time_tag.text = str(ShowTimeHistoy(item[7])) message_row.ids.chip_tag.text = item[4] - - # listItem = message_row.ids.content # secondary_text = (subject[:50] + '........' if len( # subject) >= 50 else ( @@ -132,8 +125,6 @@ class Allmails(Screen): # listItem.add_widget(chipTag(item[4])) message_row.ids.delete_msg.bind(on_press=partial( self.swipe_delete, item[5], item[4])) - - self.ids.ml.add_widget(message_row) updated_data = len(self.ids.ml.children) self.has_refreshed = True if data_exist != updated_data else False diff --git a/src/bitmessagekivy/baseclass/common.py b/src/bitmessagekivy/baseclass/common.py index abf7e0fd..857ba09a 100644 --- a/src/bitmessagekivy/baseclass/common.py +++ b/src/bitmessagekivy/baseclass/common.py @@ -6,10 +6,6 @@ from kivy.metrics import dp from kivymd.uix.list import ( ILeftBody, IRightBodyTouch, - TwoLineAvatarIconListItem, - OneLineIconListItem, - OneLineAvatarIconListItem, - OneLineListItem ) from kivy.uix.image import Image from kivymd.uix.label import MDLabel @@ -32,8 +28,8 @@ data_screens = { "name_screen": "mailDetail", "object": 0, "Import": "from bitmessagekivy.baseclass.maildetail import MailDetail", - } -,} + }, +} def chipTag(text): @@ -48,8 +44,8 @@ def chipTag(text): "center_y": 0.3 } obj.height = dp(18) - obj.text_color = (1,1,1,1) - obj.radius =[8] + obj.text_color = (1, 1, 1, 1) + obj.radius = [8] return obj @@ -72,6 +68,7 @@ def initailize_detail_page(manager): manager.add_widget(screen_object) manager.current = data_screens['MailDetail']["name_screen"] + def toast(text): """Method will display the toast message""" # pylint: disable=redefined-outer-name @@ -136,7 +133,7 @@ class TimeTagRightSampleWidget(IRightBodyTouch, MDLabel): class SwipeToDeleteItem(MDCardSwipe): text = StringProperty() - cla = Window.size[0]/2 + cla = Window.size[0] / 2 # cla = 800 swipe_distance = NumericProperty(cla) opening_time = NumericProperty(0.5) @@ -144,6 +141,6 @@ class SwipeToDeleteItem(MDCardSwipe): class CutsomSwipeToDeleteItem(MDCardSwipe): text = StringProperty() - cla = Window.size[0]/2 + cla = Window.size[0] / 2 swipe_distance = NumericProperty(cla) - opening_time = NumericProperty(0.5) \ No newline at end of file + opening_time = NumericProperty(0.5) diff --git a/src/bitmessagekivy/baseclass/draft.py b/src/bitmessagekivy/baseclass/draft.py index 3a907d9a..ec27db64 100644 --- a/src/bitmessagekivy/baseclass/draft.py +++ b/src/bitmessagekivy/baseclass/draft.py @@ -6,16 +6,12 @@ from helper_sql import sqlExecute from functools import partial from addresses import decodeAddress from kivy.clock import Clock -from kivy.metrics import dp from kivy.properties import ( ListProperty, StringProperty ) -from kivy.uix.button import Button -from kivy.uix.carousel import Carousel from kivy.uix.screenmanager import Screen from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem import state @@ -102,13 +98,12 @@ class Draft(Screen): 'ackdata': mail[5], 'senttime': mail[6]}) for item in data: message_row = SwipeToDeleteItem( - text = 'Draft', + text='Draft', ) listItem = message_row.ids.content listItem.secondary_text = item["text"] listItem.theme_text_color = "Custom" listItem.text_color = ThemeClsColor - # meny._txt_right_pad = dp(70) message_row.ids.avater_img.source = state.imageDir + '/avatar.png' listItem.bind(on_release=partial( self.draft_detail, item['ackdata'], message_row)) diff --git a/src/bitmessagekivy/baseclass/inbox.py b/src/bitmessagekivy/baseclass/inbox.py index 13ff1618..d564e5b7 100644 --- a/src/bitmessagekivy/baseclass/inbox.py +++ b/src/bitmessagekivy/baseclass/inbox.py @@ -10,11 +10,8 @@ from kivy.properties import ( ListProperty, StringProperty ) -from kivy.uix.button import Button -from kivy.uix.carousel import Carousel from kivy.uix.screenmanager import Screen from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem import state @@ -124,7 +121,7 @@ class Inbox(Screen): total_message = len(self.ids.ml.children) for item in data: message_row = SwipeToDeleteItem( - text = item["text"], + text=item["text"], ) listItem = message_row.ids.content listItem.secondary_text = item["secondary_text"] @@ -132,7 +129,7 @@ class Inbox(Screen): listItem.text_color = ThemeClsColor listItem._txt_right_pad = dp(70) image = state.imageDir + "/text_images/{}.png".format( - avatarImageFirstLetter(item["secondary_text"].strip())) + avatarImageFirstLetter(item["secondary_text"].strip())) message_row.ids.avater_img.source = image listItem.bind(on_release=partial(self.inbox_detail, item["msgid"], message_row)) message_row.ids.time_tag.text = str(ShowTimeHistoy(item["received"])) @@ -171,7 +168,7 @@ class Inbox(Screen): ) self.set_mdList(data) - def inbox_detail(self, msg_id, instance,*args): + def inbox_detail(self, msg_id, instance, *args): """Load inbox page details""" if instance.state == 'closed': instance.ids.delete_msg.disabled = True diff --git a/src/bitmessagekivy/baseclass/login.py b/src/bitmessagekivy/baseclass/login.py index 7d4a8cc7..58f56a6c 100644 --- a/src/bitmessagekivy/baseclass/login.py +++ b/src/bitmessagekivy/baseclass/login.py @@ -9,9 +9,7 @@ from kivy.uix.screenmanager import Screen import state -from bitmessagekivy.baseclass.common import ( - toast, ThemeClsColor -) +from bitmessagekivy.baseclass.common import toast class Login(Screen): @@ -108,5 +106,3 @@ class InfoLayout(BoxLayout, RectangularElevationBehavior): class RandomBoxlayout(BoxLayout): """RandomBoxlayout class for BoxLayout behaviour""" - - diff --git a/src/bitmessagekivy/baseclass/maildetail.py b/src/bitmessagekivy/baseclass/maildetail.py index 3ddd5ba9..1bb8a6c5 100644 --- a/src/bitmessagekivy/baseclass/maildetail.py +++ b/src/bitmessagekivy/baseclass/maildetail.py @@ -17,7 +17,6 @@ from kivymd.uix.list import ( OneLineListItem, IRightBodyTouch ) -from kivymd.uix.label import MDLabel from kivy.uix.screenmanager import Screen import state diff --git a/src/bitmessagekivy/baseclass/myaddress.py b/src/bitmessagekivy/baseclass/myaddress.py index e23bfd5c..3f497611 100644 --- a/src/bitmessagekivy/baseclass/myaddress.py +++ b/src/bitmessagekivy/baseclass/myaddress.py @@ -20,7 +20,7 @@ from kivy.uix.screenmanager import Screen import state from bitmessagekivy.baseclass.common import ( - avatarImageFirstLetter, AvatarSampleWidget,ThemeClsColor, + avatarImageFirstLetter, AvatarSampleWidget, ThemeClsColor, toast ) from bitmessagekivy.baseclass.popup import MyaddDetailPopup @@ -124,7 +124,6 @@ class MyAddress(Screen): meny.add_widget(ToggleBtn(active=True if is_enable == 'true' else False)) self.ids.ml.add_widget(meny) - def check_scroll_y(self, instance, somethingelse): """Load data on scroll down""" if self.ids.refresh_layout.scroll_y <= -0.0 and self.has_refreshed: diff --git a/src/bitmessagekivy/baseclass/network.py b/src/bitmessagekivy/baseclass/network.py index 89e18215..978ec65e 100644 --- a/src/bitmessagekivy/baseclass/network.py +++ b/src/bitmessagekivy/baseclass/network.py @@ -3,7 +3,6 @@ import state from kivy.clock import Clock from kivy.properties import StringProperty from kivy.uix.screenmanager import Screen -from bitmessagekivy.baseclass.common import ThemeClsColor class NetworkStat(Screen): @@ -38,4 +37,4 @@ class NetworkStat(Screen): self.text_variable_4 = 'Processed {0} public keys'.format( str(state.numberOfPubkeysProcessed)) self.text_variable_5 = '{0} object to be synced'.format( - len(objectracker.missingObjects)) \ No newline at end of file + len(objectracker.missingObjects)) diff --git a/src/bitmessagekivy/baseclass/payment.py b/src/bitmessagekivy/baseclass/payment.py index fa7bb817..3023b1df 100644 --- a/src/bitmessagekivy/baseclass/payment.py +++ b/src/bitmessagekivy/baseclass/payment.py @@ -1,5 +1,6 @@ from bmconfigparser import BMConfigParser +from bitmessagekivy.baseclass.common import toast from kivy.uix.boxlayout import BoxLayout from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivy.uix.screenmanager import Screen @@ -9,6 +10,7 @@ from kivymd.uix.list import ( OneLineAvatarIconListItem ) +import queues import state diff --git a/src/bitmessagekivy/baseclass/popup.py b/src/bitmessagekivy/baseclass/popup.py index 8a4be770..3cfa587a 100644 --- a/src/bitmessagekivy/baseclass/popup.py +++ b/src/bitmessagekivy/baseclass/popup.py @@ -230,4 +230,3 @@ class ToAddrBoxlayout(BoxLayout): class ToAddressTitle(BoxLayout): """ToAddressTitle class for BoxLayout behaviour""" - diff --git a/src/bitmessagekivy/baseclass/qrcode.py b/src/bitmessagekivy/baseclass/qrcode.py index fcf97328..6cb9383b 100644 --- a/src/bitmessagekivy/baseclass/qrcode.py +++ b/src/bitmessagekivy/baseclass/qrcode.py @@ -20,4 +20,4 @@ class ShowQRCode(Screen): self.ids.qr.add_widget(QRCodeWidget(data=address)) self.ids.qr.children[0].show_border = False instasnce.parent.parent.parent.dismiss() - toast('Show QR code') \ No newline at end of file + toast('Show QR code') diff --git a/src/bitmessagekivy/baseclass/scan_screen.py b/src/bitmessagekivy/baseclass/scan_screen.py index 34aface6..67246ca3 100644 --- a/src/bitmessagekivy/baseclass/scan_screen.py +++ b/src/bitmessagekivy/baseclass/scan_screen.py @@ -110,4 +110,4 @@ class ScanScreen(Screen): """It will open up the camera""" if not self.xcam._camera._device.isOpened(): self.xcam._camera._device.open(self.xcam._camera._index) - self.xcam.play = True \ No newline at end of file + self.xcam.play = True diff --git a/src/bitmessagekivy/baseclass/sent.py b/src/bitmessagekivy/baseclass/sent.py index 5cb2d017..d7c3dc3e 100644 --- a/src/bitmessagekivy/baseclass/sent.py +++ b/src/bitmessagekivy/baseclass/sent.py @@ -1,4 +1,3 @@ -from bitmessagekivy.get_platform import platform # from bitmessagekivy import identiconGeneration from bitmessagekivy import kivy_helper_search from bmconfigparser import BMConfigParser @@ -6,21 +5,16 @@ from functools import partial from helper_sql import sqlExecute from kivy.clock import Clock from kivy.factory import Factory -from kivy.metrics import dp from kivy.properties import StringProperty, ListProperty -from kivy.uix.button import Button -from kivy.uix.carousel import Carousel from kivy.uix.screenmanager import Screen from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem import state from bitmessagekivy.baseclass.common import ( showLimitedCnt, ThemeClsColor, avatarImageFirstLetter, - AddTimeWidget, AvatarSampleWidget, toast, SwipeToDeleteItem, - ShowTimeHistoy + toast, SwipeToDeleteItem, ShowTimeHistoy ) from bitmessagekivy.baseclass.maildetail import MailDetail @@ -98,14 +92,14 @@ class Sent(Screen): total_sent_msg = len(self.ids.ml.children) for item in data: message_row = SwipeToDeleteItem( - text = item["text"], + text=item["text"], ) listItem = message_row.ids.content listItem.secondary_text = item["secondary_text"] listItem.theme_text_color = "Custom" listItem.text_color = ThemeClsColor image = state.imageDir + '/text_images/{}.png'.format( - avatarImageFirstLetter(item['secondary_text'].strip())) + avatarImageFirstLetter(item['secondary_text'].strip())) message_row.ids.avater_img.source = image listItem.bind(on_release=partial(self.sent_detail, item['ackdata'], message_row)) message_row.ids.time_tag.text = str(ShowTimeHistoy(item['senttime'])) diff --git a/src/bitmessagekivy/baseclass/settings.py b/src/bitmessagekivy/baseclass/settings.py index fa01d472..58c01941 100644 --- a/src/bitmessagekivy/baseclass/settings.py +++ b/src/bitmessagekivy/baseclass/settings.py @@ -88,4 +88,4 @@ class Setting(Screen): # def language_callback(self, lang, dt=0): # self.children[0].active = False # state.kivyapp.tr = Lang(lang) - # toast('Language changed') \ No newline at end of file + # toast('Language changed') diff --git a/src/bitmessagekivy/baseclass/trash.py b/src/bitmessagekivy/baseclass/trash.py index 01d86318..c65ce2b5 100644 --- a/src/bitmessagekivy/baseclass/trash.py +++ b/src/bitmessagekivy/baseclass/trash.py @@ -3,17 +3,13 @@ from bmconfigparser import BMConfigParser from helper_sql import sqlExecute, sqlQuery from functools import partial from kivy.clock import Clock -from kivy.metrics import dp from kivy.properties import ( ListProperty, StringProperty ) -from kivy.uix.button import Button from kivymd.uix.button import MDFlatButton -from kivy.uix.carousel import Carousel from kivymd.uix.dialog import MDDialog from kivymd.uix.label import MDLabel -from kivymd.uix.list import TwoLineAvatarIconListItem from kivy.uix.screenmanager import Screen import state @@ -90,7 +86,7 @@ class Trash(Screen): subject = item[2].decode() if isinstance(item[2], bytes) else item[2] body = item[3].decode() if isinstance(item[3], bytes) else item[3] message_row = CutsomSwipeToDeleteItem( - text = item[1], + text=item[1], ) message_row.bind(on_swipe_complete=partial(self.on_swipe_complete, message_row)) listItem = message_row.ids.content diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 0f543d11..a3f253e2 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -81,8 +81,7 @@ elif platform == "android": t.show() -with open(os.path.join(os.path.dirname(__file__), "screens_data.json") - ) as read_file: +with open(os.path.join(os.path.dirname(__file__), "screens_data.json")) as read_file: all_data = ast.literal_eval(read_file.read()) data_screens = list(all_data.keys()) diff --git a/src/bitmessagekivy/tests/common.py b/src/bitmessagekivy/tests/common.py index 14e59609..c072aea5 100644 --- a/src/bitmessagekivy/tests/common.py +++ b/src/bitmessagekivy/tests/common.py @@ -13,5 +13,6 @@ def make_ordered_test(): return ordered, compare + ordered, compare = make_ordered_test() -unittest.defaultTestLoader.sortTestMethodsUsing = compare \ No newline at end of file +unittest.defaultTestLoader.sortTestMethodsUsing = compare diff --git a/src/bitmessagekivy/tests/telenium_process.py b/src/bitmessagekivy/tests/telenium_process.py index 72513c3b..236b4aac 100644 --- a/src/bitmessagekivy/tests/telenium_process.py +++ b/src/bitmessagekivy/tests/telenium_process.py @@ -3,8 +3,7 @@ import shutil import tempfile from telenium.tests import TeleniumTestCase -from threads import sqlThread - +# from threads import sqlThread _files = ( @@ -33,7 +32,7 @@ def set_temp_data(): for file in tmp_db_file: old_source_file = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'sampleData', file) - new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file) + new_destination_file = os.path.join(os.environ['BITMESSAGE_HOME'], file) shutil.copyfile(old_source_file, new_destination_file) diff --git a/src/bitmessagekivy/tests/test_addressbook.py b/src/bitmessagekivy/tests/test_addressbook.py index 4ae337cb..61c5a13c 100644 --- a/src/bitmessagekivy/tests/test_addressbook.py +++ b/src/bitmessagekivy/tests/test_addressbook.py @@ -1,4 +1,3 @@ -import time from bitmessagekivy.tests.telenium_process import TeleniumTestProcess from .common import ordered @@ -18,7 +17,7 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(6) self.cli.execute('app.clickNavDrawer()') self.cli.sleep(4) - self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) + self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') self.cli.sleep(4) @@ -32,25 +31,25 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[0]') self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','test1') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test1') self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(4) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[1]') self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','sectorAppartment') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', 'sectorAppartment') self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(5) self.cli.click_on('//GrashofPopup/BoxLayout[0]/MDTextField[1]') self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0]) + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', data[0]) self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', '') self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(4) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text','BM-2cX78L9CZpb6GGC3rRVizYiUBwHELMLybd') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', 'BM-2cX78L9CZpb6GGC3rRVizYiUBwHELMLybd') self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(4) @@ -62,9 +61,9 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(3) self.cli.execute('app.addingtoaddressbook()') self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]','text','test2 ') + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[0]', 'text', 'test2') self.cli.sleep(3) - self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]','text',data[0]) + self.cli.setattr('//GrashofPopup/BoxLayout[0]/MDTextField[1]', 'text', data[0]) self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[1]') @@ -77,16 +76,18 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MDRaisedButton[0]') self.cli.sleep(3) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + self.cli.click_on( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') self.cli.sleep(2) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]') self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second') self.cli.sleep(3) - random_label="" + random_label = "" for char in "Hey This is Message From Address Book": random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) self.cli.sleep(0.2) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(2) @@ -100,8 +101,11 @@ class AddressBook(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//NavigationItem[6]') self.cli.sleep(3) - self.cli.drag('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[0]', - '//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2) + self.cli.drag( + '''//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//''' + '''TwoLineAvatarIconListItem[0]/BoxLayout[0]''', + '''//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//''' + '''TwoLineAvatarIconListItem[0]/BoxLayout[2]''', 2) self.cli.sleep(2) self.cli.click_on('//AddressBook/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_allmail_message.py b/src/bitmessagekivy/tests/test_allmail_message.py index 7efad3f1..8f1b1996 100644 --- a/src/bitmessagekivy/tests/test_allmail_message.py +++ b/src/bitmessagekivy/tests/test_allmail_message.py @@ -14,7 +14,7 @@ class AllMailMessage(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//NavigationItem[5]') self.cli.sleep(4) - + @ordered def test_delete_message_from_allmail_list(self): """Delete Message From Message body of Mail Screen/Window""" diff --git a/src/bitmessagekivy/tests/test_create_random_address.py b/src/bitmessagekivy/tests/test_create_random_address.py index ab91af6d..ff8f56e1 100644 --- a/src/bitmessagekivy/tests/test_create_random_address.py +++ b/src/bitmessagekivy/tests/test_create_random_address.py @@ -8,7 +8,7 @@ from string import ascii_lowercase class CreateRandomAddress(TeleniumTestProcess): - + @classmethod def setUpClass(cls): os.environ["BITMESSAGE_HOME"] = tempfile.gettempdir() @@ -20,7 +20,9 @@ class CreateRandomAddress(TeleniumTestProcess): """Clicking on Proceed Button to Proceed to Next Screen.""" print("=====================Test - Login Screen=====================") self.cli.sleep(3) - self.cli.wait_click('//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[0]') + self.cli.wait_click( + '''//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]''' + '''/MDFillRoundFlatIconButton[0]''') self.cli.sleep(3) @ordered @@ -49,11 +51,13 @@ class CreateRandomAddress(TeleniumTestProcess): self.cli.sleep(5) self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.sleep(2) - self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) + self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[9]') self.cli.sleep(4) - self.cli.wait_click('//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]/MDFillRoundFlatIconButton[0]') + self.cli.wait_click( + '''//Login/BoxLayout[0]/BoxLayout[0]/ScreenManager[0]/Screen[0]/BoxLayout[0]/AnchorLayout[3]''' + '''/MDFillRoundFlatIconButton[0]''') self.test_random_screen() @ordered @@ -64,7 +68,7 @@ class CreateRandomAddress(TeleniumTestProcess): # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') self.cli.sleep(2) - self.cli.drag("//NavigationItem[@text=\"Address Book\"]","//NavigationItem[@text=\"Settings\"]",1) + self.cli.drag("//NavigationItem[@text=\"Address Book\"]", "//NavigationItem[@text=\"Settings\"]", 1) self.cli.sleep(2) self.cli.click_on('//NavigationItem[0]') self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_draft_message.py b/src/bitmessagekivy/tests/test_draft_message.py index 16d8d0fd..d1ea580b 100644 --- a/src/bitmessagekivy/tests/test_draft_message.py +++ b/src/bitmessagekivy/tests/test_draft_message.py @@ -21,12 +21,14 @@ class DraftMessage(TeleniumTestProcess): self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') self.cli.sleep(3) # SELECT - TO ADDRESS - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + self.cli.click_on( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') self.cli.sleep(3) # ADD FROM MESSAGE - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', + "text", 'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') self.cli.sleep(3) # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') @@ -34,14 +36,16 @@ class DraftMessage(TeleniumTestProcess): self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') self.cli.sleep(3) # SELECT - TO ADDRESS - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + self.cli.click_on( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') self.cli.sleep(1) self.cli.click_on('//MyTextInput[0]') self.cli.sleep(3) # ADD FROM MESSAGE - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text",'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', + "text", 'BM-2cSsuH1bUWBski8bvdqnK2DivMqQCeQA1J') self.cli.sleep(4) - random_label="" + random_label = "" for char in "Another Draft message": random_label += char self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', random_label) @@ -49,7 +53,7 @@ class DraftMessage(TeleniumTestProcess): # CLICK BACK-BUTTON self.cli.click_on('//MDToolbar/BoxLayout[0]/MDActionTopAppBarButton[0]') self.cli.sleep(4) - + @ordered def test_edit_and_resend_draft_messgae(self): """Select A Message From List of Messages Then @@ -67,15 +71,16 @@ class DraftMessage(TeleniumTestProcess): # CLICK EDIT BUTTON self.cli.click_on('//MDToolbar/BoxLayout[2]/MDActionTopAppBarButton[0]') self.cli.sleep(5) - random_label="" + random_label = "" for char in "Hey,This is draft Message Body": random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) + self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', + 'text', random_label) self.cli.sleep(0.2) self.cli.sleep(3) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(5) - + @ordered def test_delete_draft_message(self): """Delete A Message From List of Messages""" diff --git a/src/bitmessagekivy/tests/test_myaddress_screen.py b/src/bitmessagekivy/tests/test_myaddress_screen.py index b28fe3e7..878e53df 100644 --- a/src/bitmessagekivy/tests/test_myaddress_screen.py +++ b/src/bitmessagekivy/tests/test_myaddress_screen.py @@ -17,7 +17,7 @@ class MyAddressScreen(TeleniumTestProcess): self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') self.cli.sleep(3) - self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) + self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[11]') self.cli.sleep(4) @@ -27,7 +27,9 @@ class MyAddressScreen(TeleniumTestProcess): """Show the Qr code of selected address""" print("=====================Test -Show QR code of selected address=====================") self.cli.sleep(4) - self.cli.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]') + self.cli.click_on( + '''//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/''' + '''CustomTwoLineAvatarIconListItem[0]''') self.cli.sleep(3) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[1]/MDLabel[0]') self.cli.sleep(3) @@ -39,18 +41,22 @@ class MyAddressScreen(TeleniumTestProcess): """Send Message From Send Message From Button""" print("=====================Test -Send Message From Send Message From Button=====================") self.cli.sleep(4) - self.cli.click_on('//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/CustomTwoLineAvatarIconListItem[0]') + self.cli.click_on( + '''//MyAddress/BoxLayout[0]/FloatLayout[0]/MDScrollViewRefreshLayout[0]/MDList[0]/''' + '''CustomTwoLineAvatarIconListItem[0]''') self.cli.sleep(4) self.cli.click_on('//MyaddDetailPopup/BoxLayout[1]/MDRaisedButton[0]/MDLabel[0]') self.cli.sleep(3) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput', "text", data[1]) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput', "text", data[1]) self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Hey') self.cli.sleep(3) - random_label="" + random_label = "" for char in "Hey,i am sending message directly from MyAddress book": random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) self.cli.sleep(0.2) self.cli.sleep(2) self.cli.click_on('//MDActionTopAppBarButton[2]') diff --git a/src/bitmessagekivy/tests/test_payment_subscription.py b/src/bitmessagekivy/tests/test_payment_subscription.py index 7f8341eb..1e8da4e8 100644 --- a/src/bitmessagekivy/tests/test_payment_subscription.py +++ b/src/bitmessagekivy/tests/test_payment_subscription.py @@ -10,11 +10,12 @@ class PaymentScreen(TeleniumTestProcess): self.cli.sleep(4) self.cli.execute('app.clickNavDrawer()') self.cli.sleep(3) - self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) + self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[8]') self.cli.sleep(3) - self.cli.drag('//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[1]', + self.cli.drag( + '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[1]', '//Payment/BoxLayout[0]/ScrollView[0]/BoxLayout[0]/ProductCategoryLayout[0]/ProductLayout[0]', 1) self.cli.sleep(2) self.cli.click_on('//MDRaisedButton[3]') diff --git a/src/bitmessagekivy/tests/test_sent_message.py b/src/bitmessagekivy/tests/test_sent_message.py index 9401b87e..6a961a63 100644 --- a/src/bitmessagekivy/tests/test_sent_message.py +++ b/src/bitmessagekivy/tests/test_sent_message.py @@ -16,7 +16,7 @@ class SendMessage(TeleniumTestProcess): Sending Message From Inbox Screen opens a pop-up(screen)which send message from sender to reciever """ - print("=====================Test - Sending Message From Inbox Screen with validation Checks=====================") + print("=======Test - Sending Message From Inbox Screen with validation Checks=======") self.cli.sleep(3) # self.cli.execute('app.root.ids.nav_drawer.set_state("toggle")') self.cli.execute('app.clickNavDrawer()') @@ -29,7 +29,8 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]') self.cli.sleep(3) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]', "text", "second add") + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/MyTextInput[0]', "text", "second add") self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]') self.cli.sleep(4) @@ -39,7 +40,8 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//MDFlatButton[0]') self.cli.sleep(5) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + self.cli.click_on( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') self.cli.sleep(3) @@ -49,22 +51,24 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]') self.cli.sleep(4) - random_label="" + random_label = "" for char in "how are you this is message body": random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]','text',random_label) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', 'text', random_label) self.cli.sleep(0.2) self.cli.sleep(3) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(3) self.cli.click_on('//MDFlatButton[0]') self.cli.sleep(6) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]',"text", data[0]) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) self.cli.sleep(3) self.cli.click_on('//MDActionTopAppBarButton[2]') self.cli.sleep(3) - @ordered + @ordered def test_sent_multiple_messages(self): """ Sending Second Message From Inbox Screen @@ -79,18 +83,21 @@ class SendMessage(TeleniumTestProcess): self.cli.sleep(3) self.cli.click_on('//Inbox/ComposerButton[0]/MDFloatingActionButton[0]') self.cli.sleep(3) - self.cli.click_on('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') + self.cli.click_on( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[0]/BoxLayout[0]/CustomSpinner[0]/ArrowImg[0]') self.cli.sleep(2) self.cli.click_on('//MyTextInput[0]') self.cli.sleep(3) - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/BoxLayout[1]/BoxLayout[0]/MyTextInput[0]', "text", data[0]) self.cli.sleep(3) self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/MyMDTextField[0]', 'text', 'Second') self.cli.sleep(3) - random_label="" + random_label = "" for char in "Hey This Is Second Message Body": random_label += char - self.cli.setattr('//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]',"text",random_label) + self.cli.setattr( + '//DropDownWidget/ScrollView[0]/BoxLayout[0]/ScrollView[0]/TextInput[0]', "text", random_label) self.cli.sleep(0.2) self.cli.sleep(2) self.cli.click_on('//MDActionTopAppBarButton[2]') diff --git a/src/bitmessagekivy/tests/test_setting_screen.py b/src/bitmessagekivy/tests/test_setting_screen.py index b3773cb3..51c107c0 100644 --- a/src/bitmessagekivy/tests/test_setting_screen.py +++ b/src/bitmessagekivy/tests/test_setting_screen.py @@ -10,7 +10,7 @@ class SettingScreen(TeleniumTestProcess): self.cli.sleep(3) self.cli.execute('app.clickNavDrawer()') self.cli.sleep(3) - self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) + self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1) self.cli.sleep(3) self.cli.click_on('//NavigationItem[7]') self.cli.sleep(2) diff --git a/src/bitmessagekivy/tests/test_trash_message.py b/src/bitmessagekivy/tests/test_trash_message.py index e27cfe48..c320abb0 100644 --- a/src/bitmessagekivy/tests/test_trash_message.py +++ b/src/bitmessagekivy/tests/test_trash_message.py @@ -12,8 +12,11 @@ class TrashMessage(TeleniumTestProcess): self.cli.sleep(4) self.cli.click_on('//NavigationItem[4]') self.cli.sleep(4) - self.cli.drag('//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[0]', - '//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//TwoLineAvatarIconListItem[0]/BoxLayout[2]', 2) + self.cli.drag( + '''//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//''' + '''TwoLineAvatarIconListItem[0]/BoxLayout[0]''', + '''//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//''' + '''TwoLineAvatarIconListItem[0]/BoxLayout[2]''', 2) self.cli.sleep(4) self.cli.click_on('//Trash/BoxLayout[0]/BoxLayout[0]/ScrollView[0]/MDList[0]/Carousel[0]//Button[0]') self.cli.sleep(2) diff --git a/src/fake_addressGenerator.py b/src/fake_addressGenerator.py index baca8d53..92ae2b44 100644 --- a/src/fake_addressGenerator.py +++ b/src/fake_addressGenerator.py @@ -16,6 +16,7 @@ fake_addresses = [ 'BM-2cW2a5R1KidMGNByqPKn6nJDDnHtazoere' ] + class FakeAddressGenerator(StoppableThread): """A thread for creating fake addresses""" name = "addressGenerator" @@ -25,7 +26,7 @@ class FakeAddressGenerator(StoppableThread): queues.addressGeneratorQueue.put(("stopThread", "data")) except: pass - super(addressGenerator, self).stopThread() + super(FakeAddressGenerator, self).stopThread() def run(self): """ diff --git a/src/main_test.py b/src/main_test.py index a057379b..f521a3e6 100644 --- a/src/main_test.py +++ b/src/main_test.py @@ -4,6 +4,7 @@ from bitmessagekivy.mpybit import NavigateApp from fake_addressGenerator import FakeAddressGenerator from threads import sqlThread + def main(): if state.enableObjProc: # Start the address generation thread @@ -22,6 +23,5 @@ def main(): state.kivyapp.run() - if __name__ == '__main__': main()