~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/widgets/reviews.py

  • Committer: Natalia B. Bidart
  • Date: 2012-05-30 18:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3030.
  • Revision ID: natalia.bidart@canonical.com-20120530183955-zbnjczayktmmg5tv
- Initial test cleanup:
  - Renamed test/ dir to tests/.
  - Isolated test code into tests/ directory, including moving all the
    get_test_window_foo from the gtk3 production modules to
    tests/gtk3/windows.py module.
  - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
    execution of the suite.
  - Pep8 and pyflakes fixes in the files already modified in this branch.
  - Minor bug fix in the softwarecenter/log.py module when trying to create a
    log dir with proper perms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
943
943
        msg = _('Be the first to contribute a review for this application')
944
944
 
945
945
        EmbeddedMessage.__init__(self, title, msg, 'text-editor')
946
 
 
947
 
 
948
 
def get_test_reviews_window():
949
 
    from mock import Mock
950
 
 
951
 
    appdetails_mock = Mock()
952
 
    appdetails_mock.version = "2.0"
953
 
 
954
 
    parent = Mock()
955
 
    parent.app_details = appdetails_mock
956
 
 
957
 
    review_data = Mock()
958
 
    review_data.app_name = "app"
959
 
    review_data.usefulness_favorable = 10
960
 
    review_data.usefulness_total = 12
961
 
    review_data.usefulness_submit_error = False
962
 
    review_data.reviewer_username = "name"
963
 
    review_data.reviewer_displayname = "displayname"
964
 
    review_data.date_created = "2011-01-01 18:00:00"
965
 
    review_data.summary = "summary"
966
 
    review_data.review_text = 10 * "loonng text"
967
 
    review_data.rating = "3.0"
968
 
    review_data.version = "1.0"
969
 
 
970
 
    # create reviewslist
971
 
    vb = UIReviewsList(parent)
972
 
    vb.add_review(review_data)
973
 
    vb.configure_reviews_ui()
974
 
 
975
 
    win = Gtk.Window()
976
 
    win.set_size_request(200, 200)
977
 
    win.add(vb)
978
 
    win.connect('destroy', Gtk.main_quit)
979
 
    win.show_all()
980
 
    return win
981
 
 
982
 
if __name__ == "__main__":
983
 
    import softwarecenter.paths
984
 
    softwarecenter.paths.datadir = "./data"
985
 
 
986
 
    win = get_test_reviews_window()
987
 
 
988
 
    Gtk.main()